﻿@{
    ViewBag.Title = "Search";
    Layout = "~/Views/Shared/SearchTemplate.cshtml";
}

@section HeadContent {

<script type="text/javascript">
    window.onInitUI = function () {
        var txtName = new Ext.form.TextField({
            name: 'q.Name',
            fieldLabel: '产品名称',
            width: 150
        });
        var txtModel = new Ext.form.TextField({
            name: 'q.Model',
            fieldLabel: '产品型号',
            width: 150
        });

        var formPanel = new Ext.form.FormPanel({
            renderTo: 'search',
            border: false,
            labelWidth: 80,
            padding: '5px 5px 0 10px',
            buttonAlign: 'right',
            buttons: [
                    {
                        text: '查询',
                        type: 'submit',
                        handler: function () {
                            var form = formPanel.getForm();
                            form.submit({ url: '@Url.Action("Search", "Product")' });
                        }
                    }
                ],
            items: [
                    new Ext.utility.formRow([{ items: [txtName] }, { items: [txtModel]}])
                ]
        });

        window.searchForm = formPanel.getForm();
    };

    var gridColumns = [
            new Ext.grid.RowNumberer(),
            { Id: 'AutoExpand', header: '产品名称', sortable: true, dataIndex: 'Name', renderer: function (v, c, r) { return Ext.utility.actionLinkInNewTab(r.json.Url, v); } },
            { header: '产品型号', sortable: true, dataIndex: 'Model', width: 120 },
            { header: '产品规格', sortable: true, dataIndex: 'Specification', width: 120 },
            { header: '可销售', sortable: true, dataIndex: 'Marketable', width: 80 },
            { header: '使用次数', sortable: true, dataIndex: 'UseCount', width: 80 },
            { header: '采购价', sortable: true, dataIndex: 'ProcurementPrice', width: 80, type: 'float' },
            { header: '销售价', sortable: true, dataIndex: 'SellingPrice', width: 80, type: 'float' }
        ];
    </script>

}
